Raspberry Pi /RP2350 /XIP_CTRL /CTRL

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text

Interpret as CTRL

31 2827 2423 2019 1615 1211 87 43 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (EN_SECURE)EN_SECURE 0 (EN_NONSECURE)EN_NONSECURE 0 (POWER_DOWN)POWER_DOWN 0 (NO_UNCACHED_SEC)NO_UNCACHED_SEC 0 (NO_UNCACHED_NONSEC)NO_UNCACHED_NONSEC 0 (NO_UNTRANSLATED_SEC)NO_UNTRANSLATED_SEC 0 (NO_UNTRANSLATED_NONSEC)NO_UNTRANSLATED_NONSEC 0 (MAINT_NONSEC)MAINT_NONSEC 0 (SPLIT_WAYS)SPLIT_WAYS 0 (WRITABLE_M0)WRITABLE_M0 0 (WRITABLE_M1)WRITABLE_M1

Description

Cache control register. Read-only from a Non-secure context.

Fields

EN_SECURE

When 1, enable the cache for Secure accesses. When enabled, Secure XIP accesses to the cached (addr[26] == 0) window will query the cache, and QSPI accesses are performed only if the requested data is not present. When disabled, Secure access ignore the cache contents, and always access the QSPI interface.

Accesses to the uncached (addr[26] == 1) window will never query the cache, irrespective of this bit.

There is no cache-as-SRAM address window. Cache lines are allocated for SRAM-like use by individually pinning them, and keeping the cache enabled.

EN_NONSECURE

When 1, enable the cache for Non-secure accesses. When enabled, Non-secure XIP accesses to the cached (addr[26] == 0) window will query the cache, and QSPI accesses are performed only if the requested data is not present. When disabled, Secure access ignore the cache contents, and always access the QSPI interface.

Accesses to the uncached (addr[26] == 1) window will never query the cache, irrespective of this bit.

POWER_DOWN

When 1, the cache memories are powered down. They retain state, but can not be accessed. This reduces static power dissipation. Writing 1 to this bit forces CTRL_EN_SECURE and CTRL_EN_NONSECURE to 0, i.e. the cache cannot be enabled when powered down.

NO_UNCACHED_SEC

When 1, Secure accesses to the uncached window (addr[27:26] == 1) will generate a bus error. This may reduce the number of SAU/MPU/PMP regions required to protect flash contents.

Note this does not disable access to the uncached, untranslated window – see NO_UNTRANSLATED_SEC.

NO_UNCACHED_NONSEC

When 1, Non-secure accesses to the uncached window (addr[27:26] == 1) will generate a bus error. This may reduce the number of SAU/MPU/PMP regions required to protect flash contents.

Note this does not disable access to the uncached, untranslated window – see NO_UNTRANSLATED_SEC.

NO_UNTRANSLATED_SEC

When 1, Secure accesses to the uncached, untranslated window (addr[27:26] == 3) will generate a bus error.

NO_UNTRANSLATED_NONSEC

When 1, Non-secure accesses to the uncached, untranslated window (addr[27:26] == 3) will generate a bus error.

MAINT_NONSEC

When 0, Non-secure accesses to the cache maintenance address window (addr[27] == 1, addr[26] == 0) will generate a bus error. When 1, Non-secure accesses can perform cache maintenance operations by writing to the cache maintenance address window.

Cache maintenance operations may be used to corrupt Secure data by invalidating cache lines inappropriately, or map Secure content into a Non-secure region by pinning cache lines. Therefore this bit should generally be set to 0, unless Secure code is not using the cache.

Care should also be taken to clear the cache data memory and tag memory before granting maintenance operations to Non-secure code.

SPLIT_WAYS

When 1, route all cached+Secure accesses to way 0 of the cache, and route all cached+Non-secure accesses to way 1 of the cache.

This partitions the cache into two half-sized direct-mapped regions, such that Non-secure code can not observe cache line state changes caused by Secure execution.

A full cache flush is required when changing the value of SPLIT_WAYS. The flush should be performed whilst SPLIT_WAYS is 0, so that both cache ways are accessible for invalidation.

WRITABLE_M0

If 1, enable writes to XIP memory window 0 (addresses 0x10000000 through 0x10ffffff, and their uncached mirrors). If 0, this region is read-only.

XIP memory is read-only by default. This bit must be set to enable writes if a RAM device is attached on QSPI chip select 0.

The default read-only behaviour avoids two issues with writing to a read-only QSPI device (e.g. flash). First, a write will initially appear to succeed due to caching, but the data will eventually be lost when the written line is evicted, causing unpredictable behaviour.

Second, when a written line is evicted, it will cause a write command to be issued to the flash, which can break the flash out of its continuous read mode. After this point, flash reads will return garbage. This is a security concern, as it allows Non-secure software to break Secure flash reads if it has permission to write to any flash address.

Note the read-only behaviour is implemented by downgrading writes to reads, so writes will still cause allocation of an address, but have no other effect.

WRITABLE_M1

If 1, enable writes to XIP memory window 1 (addresses 0x11000000 through 0x11ffffff, and their uncached mirrors). If 0, this region is read-only.

XIP memory is read-only by default. This bit must be set to enable writes if a RAM device is attached on QSPI chip select 1.

The default read-only behaviour avoids two issues with writing to a read-only QSPI device (e.g. flash). First, a write will initially appear to succeed due to caching, but the data will eventually be lost when the written line is evicted, causing unpredictable behaviour.

Second, when a written line is evicted, it will cause a write command to be issued to the flash, which can break the flash out of its continuous read mode. After this point, flash reads will return garbage. This is a security concern, as it allows Non-secure software to break Secure flash reads if it has permission to write to any flash address.

Note the read-only behaviour is implemented by downgrading writes to reads, so writes will still cause allocation of an address, but have no other effect.

Links

() ()